<html>
<head><meta charset="utf-8"><title>Access to metadata (DEP_xxx_xxx) from build dependency · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Access.20to.20metadata.20(DEP_xxx_xxx).20from.20build.20dependency.html">Access to metadata (DEP_xxx_xxx) from build dependency</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="206350433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Access%20to%20metadata%20%28DEP_xxx_xxx%29%20from%20build%20dependency/near/206350433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sander van Harmelen <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Access.20to.20metadata.20(DEP_xxx_xxx).20from.20build.20dependency.html#206350433">(Aug 08 2020 at 14:37)</a>:</h4>
<p>I have a sys crate that builds, using the cmake crate, a lib that statically links to openssl. I'm trying to use the openssl-sys crate for this (with the vendored feature), but noticed that I don't have access to the DEP_OPENSSL_ROOT env var in my build script when declaring the openssl-sys crate as a build-dependency. The env var is available when I move the openssl-sys package to the dependencies section, but I don't need it in my sys crate after the build is done. So is this expected? Or is there something I can do to "fix" this? Thanks!</p>



<a name="206351473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Access%20to%20metadata%20%28DEP_xxx_xxx%29%20from%20build%20dependency/near/206351473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Access.20to.20metadata.20(DEP_xxx_xxx).20from.20build.20dependency.html#206351473">(Aug 08 2020 at 15:07)</a>:</h4>
<p>Build dependencies are for the host. If you try to link to openssl using a build-dependency, it wouldn't work when cross-compiling.</p>



<a name="206354640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/Access%20to%20metadata%20%28DEP_xxx_xxx%29%20from%20build%20dependency/near/206354640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Sander van Harmelen <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/Access.20to.20metadata.20(DEP_xxx_xxx).20from.20build.20dependency.html#206354640">(Aug 08 2020 at 16:33)</a>:</h4>
<p>Thanks for the info as I didn't realise that was the case (while it makes a lot of sense). So my observation is correct, but its by design (expected behaviour).</p>
<p>I guess that also explains why I noticed the openssl-sys crate being build/compiled twice when cross compiling. One was probably for the target en one for the host (since I specified it as build-dep for the sys crate, but another crate used by the app also has it listed as a normal dep).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>